

#ifndef __MEMSPACE_H
#define __MEMSPACE_H

#define MSP_SAFE -1
#define MSP_NEEDS_RESIZE -2

struct memspace
{
  void *limit;
  void *offset;
  char data[];
};

struct memspace *
msp_init(unsigned int size);

void *
msp_addr(struct memspace *mp);

void *
msp_alloc(struct memspace **mp, unsigned int size);

int
msp_check(struct memspace *mp, unsigned int size);

#endif
